var express = require('express')
var router = express.Router()

router.get('/', function (req, res, next) {

    if (req.session.user) {
        req.session.cookie.maxAge = 0
        req.session.destroy(function (err, data) {
            if (err) {
                res.json({
                    status: '500',
                    msg: err.message,
                    result: {}
                })
            } else {
                console.log(req.session)
                res.json({
                    status: '1',
                    msg: '登出成功',
                    result: {}
                })
            }
        })
    } else {
        res.json({
            status: '0',
            msg: '用户未登录',
            result: {}
        })
    }
})
module.exports = router